<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="js/vue.js"></script>
</head>
<body>
<div id="app">
    <img :src="img" v-on:click="clickImg">
</div>

</body>
<script>
import axios from 'axios'
let app = new Vue({
    el: '#app',
    data: {
        img: 'image/a.png'
    },
    methods: {
      async clickImg() {
        console.log('点击')
        try {
          const response = await axios.get('https://jsonplaceholder.typicode.com/users');
          this.data = response.data;
        } catch (err) {
          this.error = '请求失败，请重试';
          console.error(err);
        } finally {
          this.loading = false;
        }
      },
}
});

</script>
</html>
